/**
 * @Project Name:cn.hoofungson.studio
 * @Package Name:cn.hoofungson.sso.controller
 * @Since JDK 1.8
 */
package cn.hoofungson.sso.controller;

import cn.hoofungson.sso.model.User;
import cn.hoofungson.sso.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description: 用户控制器
 * @Author 胡松 hoofungson@163.com
 * @Date 2017-11-10 22:45
 * @Version V1.0
 */
@Controller
@RequestMapping(value = "/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping (value = "/doLogin", method = RequestMethod.POST,produces="application/json;charset=UTF-8")
    public ResponseEntity<String> doLogin(HttpServletRequest request, HttpServletResponse response, @ModelAttribute User user){
        return userService.login(request, response, user);
    }
}
